<template>
    <div class="revocation">
      <el-dialog
        title="撤销"
        :visible.sync="dialogTableVisible"
        :close-on-click-modal="false"
        :before-close="close"
        width="1000px">
        <table class="table" border="1" rules="all">
          <tr>
            <td class="title">报修单号</td>
            <td>{{revocaData.oddNumber}}</td>
            <td class="title">报障时间</td>
            <td>{{revocaData.theRepairTime}}</td>
            <td class="title">报修人</td>
            <td>{{revocaData.repairsUserName}}</td>
          </tr>
          <tr>
            <td>故障类型</td>
            <td>{{revocaData.faultTypeName}}</td>
            <td>故障等级</td>
            <td colspan="3">
              <span v-if="revocaData.faultState==1">一般</span>
              <span v-if="revocaData.faultState==2">严重</span>
              <span v-if="revocaData.faultState==3">紧急</span>
              <span v-if="revocaData.faultState==4">技术改造</span>
            </td>
          </tr>
          <tr>
            <td>故障描述</td>
            <td colspan="5">{{revocaData.repairsDescribe}}</td>
          </tr>
          <tr>
            <td>撤销原因</td>
            <td colspan="5">
              <el-input v-model="form.content" size="small" type="textarea" :rows="5" placeholder="请输入撤销原因"></el-input>
            </td>
          </tr>
        </table>
        <span slot="footer" class="dialog-footer">
          <el-button size="mini" type="primary" @click="sumbit">确定</el-button>
        </span>
      </el-dialog>
    </div>
</template>

<script>
    import {reportForRepairRevoke} from '@/api/repair/index'
    export default {
      props:{
        revocaData:'',
      },
      name: "revocation.vue",
      data(){
        return{
          dialogTableVisible:true,
          form:{
            content:null,
          },
        }
      },
      methods:{
        close(){
          this.$emit('selectChange')
        },
        sumbit(){
          if(!this.form.content){
            this.$message.warning('请填写撤销原因！')
            return
          }
         
          reportForRepairRevoke(this.revocaData.id,this.form).then((res)=>{
            if(res.code==200){
              this.$message.success(res.msg)
              this.$emit('selectChange',11)
            }
          })
          
        }
      }
    }
</script>

<style  lang="scss">
.revocation{
  .el-dialog{
    margin-top: 15vh !important;
  }
  .table {
    width: 900px;
    border: 1px solid #cccccc;
    color: #606266;
    font-size: inherit;

    tr {
      td:nth-child(2n-1) {
        width: 100px;
        text-align: center;
      }
      td:nth-child(2n) {
        width: 200px;
        padding-left: 10px;
      }
      td {
        line-height: 35px;
        .el-textarea__inner{
          border:none;
        }
      }
    }
  }
}
</style>
